﻿using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using System.Collections.Generic;
using XbsWebAPI.Application;
using XbsWebAPI.Core.Tools;
using XbsWebAPI.MainHost.Tools;

namespace XbsWebAPI.MainHost.Controllers
{
    /// <summary>
    /// 通用功能
    /// </summary>
    [ApiController]
    [Route("api/xbs_v1/[controller]")]
    public class CommomController : Controller
    {
        public CommomController()
        {

        }

        /// <summary>
        /// 上传图片
        /// </summary>
        /// <returns></returns>
        [HttpPost,Route("[action]")]
        public ResultDto<List<string>> Upload([FromForm]List<IFormFile> files)
        {
            var filesNames = UploadHelper.Upload(files, WebPath.Path);
            var result = new ResultDto<List<string>>();
            result.Code = 0;
            result.Message = "操作成功";
            result.Result = filesNames;
            return result;
        }
    }
}
